import request from '@/utils/request'

// 查询项目团队成员列表
export function listDealTeam(query) {
  return request({
    url: '/team/dealTeam/list',
    method: 'post',
    data: query
  })
}

// 查询项目团队成员详细
export function getDealTeam(id) {
  return request({
    url: '/team/dealTeam/' + id,
    method: 'get'
  })
}

// 保存项目团队成员
export function saveDealTeam(data) {
  return request({
    url: '/team/dealTeam/save',
    method: 'post',
    data: data
  })
}

// 删除项目团队成员
export function delDealTeam(id) {
  return request({
    url: '/team/dealTeam/' + id,
    method: 'delete'
  })
}

// 导出项目团队成员
export function exportDealTeam(query) {
  return request({
    url: '/team/dealTeam/export',
    method: 'get',
    params: query
  })
}

// 替换项目负责人, 原项目负责人变为项目成员
export function replaceProjectLeader(param) {
  return request({
    url: '/team/dealTeam/replaceProjectLeader?oldId=' + param.oldId,
    method: 'post',
    data: param
  })
}

// 根据角色查询
export function findByRole(role) {
  return request({
    url: '/team/dealTeam/findByRole/' + role,
    method: 'get'
  })
}

// 保存项目团队成员列表
export function saveTeamList(params) {
  return request({
    url: '/team/dealTeam/saveTeamList/' + params.pageNum + '/' + params.pageSize,
    method: 'post',
    data: params.list
  })
}
